{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:10:39.346495Z",
     "iopub.status.busy": "2021-05-29T12:10:39.345497Z",
     "iopub.status.idle": "2021-05-29T12:10:39.363496Z",
     "shell.execute_reply": "2021-05-29T12:10:39.361495Z",
     "shell.execute_reply.started": "2021-05-29T12:10:39.346495Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "import pandas as pd\n",
    "import numpy as np\n",
    "from pandas.tseries.offsets import Hour,Minute,Day"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.613156Z",
     "iopub.status.busy": "2021-05-29T11:48:26.612166Z",
     "iopub.status.idle": "2021-05-29T11:48:26.625690Z",
     "shell.execute_reply": "2021-05-29T11:48:26.623694Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.613156Z"
    }
   },
   "outputs": [],
   "source": [
    "cwd = os.getcwd()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.629687Z",
     "iopub.status.busy": "2021-05-29T11:48:26.628696Z",
     "iopub.status.idle": "2021-05-29T11:48:26.641687Z",
     "shell.execute_reply": "2021-05-29T11:48:26.639688Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.628696Z"
    }
   },
   "outputs": [],
   "source": [
    "data_dir = os.path.join(cwd,\"数据\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.677691Z",
     "iopub.status.busy": "2021-05-29T11:48:26.676690Z",
     "iopub.status.idle": "2021-05-29T11:48:26.688691Z",
     "shell.execute_reply": "2021-05-29T11:48:26.687690Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.677691Z"
    }
   },
   "outputs": [],
   "source": [
    "data_files = [file for file in os.listdir(data_dir) if os.path.splitext(file)[1] in ['.csv']]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:26:40.720513Z",
     "iopub.status.busy": "2021-05-29T12:26:40.719513Z",
     "iopub.status.idle": "2021-05-29T12:26:40.741809Z",
     "shell.execute_reply": "2021-05-29T12:26:40.739808Z",
     "shell.execute_reply.started": "2021-05-29T12:26:40.720513Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['data_fam_fleet.csv',\n",
       " 'data_fam_market_share.csv',\n",
       " 'data_fam_products.csv',\n",
       " 'data_fam_schedule.csv',\n",
       " 'group1.csv',\n",
       " 'group2.csv',\n",
       " 'group3.csv',\n",
       " 'new_schedual.csv']"
      ]
     },
     "execution_count": 67,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "data_files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.710695Z",
     "iopub.status.busy": "2021-05-29T11:48:26.709695Z",
     "iopub.status.idle": "2021-05-29T11:48:26.739693Z",
     "shell.execute_reply": "2021-05-29T11:48:26.735695Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.710695Z"
    }
   },
   "outputs": [],
   "source": [
    "schedual = pd.read_csv(os.path.join(data_dir,data_files[-1]),index_col=0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.743696Z",
     "iopub.status.busy": "2021-05-29T11:48:26.741698Z",
     "iopub.status.idle": "2021-05-29T11:48:26.785699Z",
     "shell.execute_reply": "2021-05-29T11:48:26.783699Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.743696Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>dep_ucl</th>\n",
       "      <th>arr_ucl</th>\n",
       "      <th>delta_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>814</th>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>2021-05-29 23:55:00</td>\n",
       "      <td>2021-05-30 09:35:00</td>\n",
       "      <td>2021-05-30 09:55:00</td>\n",
       "      <td>2021-05-30 16:35:00</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>AA0017NJBTFB</td>\n",
       "      <td>2021-05-29 08:10:00</td>\n",
       "      <td>2021-05-29 11:44:00</td>\n",
       "      <td>2021-05-29 12:10:00</td>\n",
       "      <td>2021-05-29 18:44:00</td>\n",
       "      <td>394.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136</th>\n",
       "      <td>AA0139PSEBOD</td>\n",
       "      <td>2021-05-29 09:40:00</td>\n",
       "      <td>2021-05-29 13:11:00</td>\n",
       "      <td>2021-05-29 14:40:00</td>\n",
       "      <td>2021-05-29 21:11:00</td>\n",
       "      <td>391.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>AA0035CPTQEY</td>\n",
       "      <td>2021-05-29 16:50:00</td>\n",
       "      <td>2021-05-29 20:11:00</td>\n",
       "      <td>2021-05-29 20:50:00</td>\n",
       "      <td>2021-05-30 03:11:00</td>\n",
       "      <td>381.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>AA0019NDPTFB</td>\n",
       "      <td>2021-05-29 18:15:00</td>\n",
       "      <td>2021-05-29 21:35:00</td>\n",
       "      <td>2021-05-29 22:15:00</td>\n",
       "      <td>2021-05-30 04:35:00</td>\n",
       "      <td>380.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Flight              deptime              arrtime  \\\n",
       "814  AA2702IOMCMJ  2021-05-29 23:55:00  2021-05-30 09:35:00   \n",
       "13   AA0017NJBTFB  2021-05-29 08:10:00  2021-05-29 11:44:00   \n",
       "136  AA0139PSEBOD  2021-05-29 09:40:00  2021-05-29 13:11:00   \n",
       "25   AA0035CPTQEY  2021-05-29 16:50:00  2021-05-29 20:11:00   \n",
       "15   AA0019NDPTFB  2021-05-29 18:15:00  2021-05-29 21:35:00   \n",
       "\n",
       "                 dep_ucl              arr_ucl  delta_time  \n",
       "814  2021-05-30 09:55:00  2021-05-30 16:35:00       400.0  \n",
       "13   2021-05-29 12:10:00  2021-05-29 18:44:00       394.0  \n",
       "136  2021-05-29 14:40:00  2021-05-29 21:11:00       391.0  \n",
       "25   2021-05-29 20:50:00  2021-05-30 03:11:00       381.0  \n",
       "15   2021-05-29 22:15:00  2021-05-30 04:35:00       380.0  "
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schedual.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.787701Z",
     "iopub.status.busy": "2021-05-29T11:48:26.787701Z",
     "iopub.status.idle": "2021-05-29T11:48:26.801700Z",
     "shell.execute_reply": "2021-05-29T11:48:26.799699Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.787701Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['group1.csv', 'group2.csv', 'group3.csv']"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "import re\n",
    "group_files = [file for file in os.listdir(data_dir) if re.match(r'group\\d.csv',file)]\n",
    "group_files"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.803699Z",
     "iopub.status.busy": "2021-05-29T11:48:26.802699Z",
     "iopub.status.idle": "2021-05-29T11:48:26.911709Z",
     "shell.execute_reply": "2021-05-29T11:48:26.910722Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.803699Z"
    }
   },
   "outputs": [],
   "source": [
    "groups = []\n",
    "for file in group_files:\n",
    "    group = pd.read_csv(os.path.join(data_dir,file),index_col=0)\n",
    "#     group = group.dropna(axis=1,how='all')\n",
    "    groups.append(group)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.914711Z",
     "iopub.status.busy": "2021-05-29T11:48:26.913708Z",
     "iopub.status.idle": "2021-05-29T11:48:26.943712Z",
     "shell.execute_reply": "2021-05-29T11:48:26.942711Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.914711Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>B</td>\n",
       "      <td>230.000000</td>\n",
       "      <td>2.290000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>G</td>\n",
       "      <td>100.000000</td>\n",
       "      <td>2.070000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>H</td>\n",
       "      <td>105.000000</td>\n",
       "      <td>0.660000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>K</td>\n",
       "      <td>94.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>L</td>\n",
       "      <td>145.000000</td>\n",
       "      <td>13.120000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47185</th>\n",
       "      <td>IOM</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>Q</td>\n",
       "      <td>211.548112</td>\n",
       "      <td>8.666667</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47186</th>\n",
       "      <td>IOM</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>S</td>\n",
       "      <td>133.410115</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47187</th>\n",
       "      <td>IOM</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>T</td>\n",
       "      <td>312.683254</td>\n",
       "      <td>1.430000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47188</th>\n",
       "      <td>IOM</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>V</td>\n",
       "      <td>380.136667</td>\n",
       "      <td>14.603333</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>47189</th>\n",
       "      <td>IOM</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>Y</td>\n",
       "      <td>490.195575</td>\n",
       "      <td>27.300000</td>\n",
       "      <td>1</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>10142 rows × 7 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Origin Destination       Flight1 Class        Fare        TRD  \\\n",
       "0        BER         BOD  AA0040BERBOD     B  230.000000   2.290000   \n",
       "1        BER         BOD  AA0040BERBOD     G  100.000000   2.070000   \n",
       "2        BER         BOD  AA0040BERBOD     H  105.000000   0.660000   \n",
       "3        BER         BOD  AA0040BERBOD     K   94.000000   0.000000   \n",
       "4        BER         BOD  AA0040BERBOD     L  145.000000  13.120000   \n",
       "...      ...         ...           ...   ...         ...        ...   \n",
       "47185    IOM         CMJ  AA2702IOMCMJ     Q  211.548112   8.666667   \n",
       "47186    IOM         CMJ  AA2702IOMCMJ     S  133.410115   0.000000   \n",
       "47187    IOM         CMJ  AA2702IOMCMJ     T  312.683254   1.430000   \n",
       "47188    IOM         CMJ  AA2702IOMCMJ     V  380.136667  14.603333   \n",
       "47189    IOM         CMJ  AA2702IOMCMJ     Y  490.195575  27.300000   \n",
       "\n",
       "       Transfer times  \n",
       "0                   1  \n",
       "1                   1  \n",
       "2                   1  \n",
       "3                   1  \n",
       "4                   1  \n",
       "...               ...  \n",
       "47185               1  \n",
       "47186               1  \n",
       "47187               1  \n",
       "47188               1  \n",
       "47189               1  \n",
       "\n",
       "[10142 rows x 7 columns]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "groups[0]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:48:26.947713Z",
     "iopub.status.busy": "2021-05-29T11:48:26.945714Z",
     "iopub.status.idle": "2021-05-29T11:48:26.976714Z",
     "shell.execute_reply": "2021-05-29T11:48:26.974728Z",
     "shell.execute_reply.started": "2021-05-29T11:48:26.947713Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>dep_ucl</th>\n",
       "      <th>arr_ucl</th>\n",
       "      <th>delta_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>814</th>\n",
       "      <td>AA2702IOMCMJ</td>\n",
       "      <td>2021-05-29 23:55:00</td>\n",
       "      <td>2021-05-30 09:35:00</td>\n",
       "      <td>2021-05-30 09:55:00</td>\n",
       "      <td>2021-05-30 16:35:00</td>\n",
       "      <td>400.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>AA0017NJBTFB</td>\n",
       "      <td>2021-05-29 08:10:00</td>\n",
       "      <td>2021-05-29 11:44:00</td>\n",
       "      <td>2021-05-29 12:10:00</td>\n",
       "      <td>2021-05-29 18:44:00</td>\n",
       "      <td>394.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>136</th>\n",
       "      <td>AA0139PSEBOD</td>\n",
       "      <td>2021-05-29 09:40:00</td>\n",
       "      <td>2021-05-29 13:11:00</td>\n",
       "      <td>2021-05-29 14:40:00</td>\n",
       "      <td>2021-05-29 21:11:00</td>\n",
       "      <td>391.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>AA0035CPTQEY</td>\n",
       "      <td>2021-05-29 16:50:00</td>\n",
       "      <td>2021-05-29 20:11:00</td>\n",
       "      <td>2021-05-29 20:50:00</td>\n",
       "      <td>2021-05-30 03:11:00</td>\n",
       "      <td>381.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>AA0019NDPTFB</td>\n",
       "      <td>2021-05-29 18:15:00</td>\n",
       "      <td>2021-05-29 21:35:00</td>\n",
       "      <td>2021-05-29 22:15:00</td>\n",
       "      <td>2021-05-30 04:35:00</td>\n",
       "      <td>380.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           Flight              deptime              arrtime  \\\n",
       "814  AA2702IOMCMJ  2021-05-29 23:55:00  2021-05-30 09:35:00   \n",
       "13   AA0017NJBTFB  2021-05-29 08:10:00  2021-05-29 11:44:00   \n",
       "136  AA0139PSEBOD  2021-05-29 09:40:00  2021-05-29 13:11:00   \n",
       "25   AA0035CPTQEY  2021-05-29 16:50:00  2021-05-29 20:11:00   \n",
       "15   AA0019NDPTFB  2021-05-29 18:15:00  2021-05-29 21:35:00   \n",
       "\n",
       "                 dep_ucl              arr_ucl  delta_time  \n",
       "814  2021-05-30 09:55:00  2021-05-30 16:35:00       400.0  \n",
       "13   2021-05-29 12:10:00  2021-05-29 18:44:00       394.0  \n",
       "136  2021-05-29 14:40:00  2021-05-29 21:11:00       391.0  \n",
       "25   2021-05-29 20:50:00  2021-05-30 03:11:00       381.0  \n",
       "15   2021-05-29 22:15:00  2021-05-30 04:35:00       380.0  "
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schedual.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:49:43.717923Z",
     "iopub.status.busy": "2021-05-29T11:49:43.716923Z",
     "iopub.status.idle": "2021-05-29T11:49:43.772928Z",
     "shell.execute_reply": "2021-05-29T11:49:43.769928Z",
     "shell.execute_reply.started": "2021-05-29T11:49:43.717923Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "      <th>Flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>dep_ucl</th>\n",
       "      <th>arr_ucl</th>\n",
       "      <th>delta_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>B</td>\n",
       "      <td>230.0</td>\n",
       "      <td>2.29</td>\n",
       "      <td>1</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>G</td>\n",
       "      <td>100.0</td>\n",
       "      <td>2.07</td>\n",
       "      <td>1</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>H</td>\n",
       "      <td>105.0</td>\n",
       "      <td>0.66</td>\n",
       "      <td>1</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>K</td>\n",
       "      <td>94.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>1</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>L</td>\n",
       "      <td>145.0</td>\n",
       "      <td>13.12</td>\n",
       "      <td>1</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "  Origin Destination       Flight1 Class   Fare    TRD  Transfer times  \\\n",
       "0    BER         BOD  AA0040BERBOD     B  230.0   2.29               1   \n",
       "1    BER         BOD  AA0040BERBOD     G  100.0   2.07               1   \n",
       "2    BER         BOD  AA0040BERBOD     H  105.0   0.66               1   \n",
       "3    BER         BOD  AA0040BERBOD     K   94.0   0.00               1   \n",
       "4    BER         BOD  AA0040BERBOD     L  145.0  13.12               1   \n",
       "\n",
       "         Flight              deptime              arrtime  \\\n",
       "0  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "1  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "3  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "4  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "\n",
       "               dep_ucl              arr_ucl  delta_time  \n",
       "0  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "1  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "2  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "3  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "4  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  "
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group1 = pd.merge(groups[0],schedual,left_on='Flight1',\n",
    "                  right_on='Flight',how='inner')\n",
    "group1.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 处理一次转机的问题 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 53,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:19:41.450858Z",
     "iopub.status.busy": "2021-05-29T12:19:41.449857Z",
     "iopub.status.idle": "2021-05-29T12:19:41.482406Z",
     "shell.execute_reply": "2021-05-29T12:19:41.480884Z",
     "shell.execute_reply.started": "2021-05-29T12:19:41.450858Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>B</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>G</td>\n",
       "      <td>252.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>H</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.33</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>K</td>\n",
       "      <td>245.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>L</td>\n",
       "      <td>341.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Origin Destination       Flight1       Flight2 Class   Fare   TRD  \\\n",
       "22    BER         TFB  AA0040BERBOD  AA0104BODTFB     B  512.0  0.00   \n",
       "23    BER         TFB  AA0040BERBOD  AA0104BODTFB     G  252.0  0.00   \n",
       "24    BER         TFB  AA0040BERBOD  AA0104BODTFB     H  512.0  0.33   \n",
       "25    BER         TFB  AA0040BERBOD  AA0104BODTFB     K  245.0  0.00   \n",
       "26    BER         TFB  AA0040BERBOD  AA0104BODTFB     L  341.0  0.00   \n",
       "\n",
       "    Transfer times  \n",
       "22               2  \n",
       "23               2  \n",
       "24               2  \n",
       "25               2  \n",
       "26               2  "
      ]
     },
     "execution_count": 53,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "groups[1].head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:22:17.080257Z",
     "iopub.status.busy": "2021-05-29T12:22:17.079253Z",
     "iopub.status.idle": "2021-05-29T12:22:17.110550Z",
     "shell.execute_reply": "2021-05-29T12:22:17.108550Z",
     "shell.execute_reply.started": "2021-05-29T12:22:17.080257Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count            69564\n",
       "unique             789\n",
       "top       AA0097TFBBOD\n",
       "freq               429\n",
       "dtype: object"
      ]
     },
     "execution_count": 59,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "pd.concat([groups[1].Flight1,groups[1].Flight2]).describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:23:10.547222Z",
     "iopub.status.busy": "2021-05-29T12:23:10.546220Z",
     "iopub.status.idle": "2021-05-29T12:23:10.573403Z",
     "shell.execute_reply": "2021-05-29T12:23:10.571402Z",
     "shell.execute_reply.started": "2021-05-29T12:23:10.547222Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "count            34782\n",
       "unique             453\n",
       "top       AA0120BODTFB\n",
       "freq               352\n",
       "Name: Flight1, dtype: object"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "groups[1].Flight1.isin(schedual.Flight)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:24:54.635978Z",
     "iopub.status.busy": "2021-05-29T12:24:54.635978Z",
     "iopub.status.idle": "2021-05-29T12:24:54.683982Z",
     "shell.execute_reply": "2021-05-29T12:24:54.680981Z",
     "shell.execute_reply.started": "2021-05-29T12:24:54.635978Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>3124</th>\n",
       "      <td>BOD</td>\n",
       "      <td>TJU</td>\n",
       "      <td>AA0066BODKOV</td>\n",
       "      <td>AA0070KOVTJU</td>\n",
       "      <td>B</td>\n",
       "      <td>155.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3125</th>\n",
       "      <td>BOD</td>\n",
       "      <td>TJU</td>\n",
       "      <td>AA0066BODKOV</td>\n",
       "      <td>AA0070KOVTJU</td>\n",
       "      <td>G</td>\n",
       "      <td>147.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3126</th>\n",
       "      <td>BOD</td>\n",
       "      <td>TJU</td>\n",
       "      <td>AA0066BODKOV</td>\n",
       "      <td>AA0070KOVTJU</td>\n",
       "      <td>H</td>\n",
       "      <td>242.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3127</th>\n",
       "      <td>BOD</td>\n",
       "      <td>TJU</td>\n",
       "      <td>AA0066BODKOV</td>\n",
       "      <td>AA0070KOVTJU</td>\n",
       "      <td>K</td>\n",
       "      <td>99.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3128</th>\n",
       "      <td>BOD</td>\n",
       "      <td>TJU</td>\n",
       "      <td>AA0066BODKOV</td>\n",
       "      <td>AA0070KOVTJU</td>\n",
       "      <td>L</td>\n",
       "      <td>172.0</td>\n",
       "      <td>0.33</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37747</th>\n",
       "      <td>QTQ</td>\n",
       "      <td>TFB</td>\n",
       "      <td>BA2168QTQQEY</td>\n",
       "      <td>BA2478QEYTFB</td>\n",
       "      <td>Q</td>\n",
       "      <td>83.0</td>\n",
       "      <td>0.01</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37748</th>\n",
       "      <td>QTQ</td>\n",
       "      <td>TFB</td>\n",
       "      <td>BA2168QTQQEY</td>\n",
       "      <td>BA2478QEYTFB</td>\n",
       "      <td>S</td>\n",
       "      <td>98.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37749</th>\n",
       "      <td>QTQ</td>\n",
       "      <td>TFB</td>\n",
       "      <td>BA2168QTQQEY</td>\n",
       "      <td>BA2478QEYTFB</td>\n",
       "      <td>T</td>\n",
       "      <td>105.0</td>\n",
       "      <td>3.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37750</th>\n",
       "      <td>QTQ</td>\n",
       "      <td>TFB</td>\n",
       "      <td>BA2168QTQQEY</td>\n",
       "      <td>BA2478QEYTFB</td>\n",
       "      <td>V</td>\n",
       "      <td>178.0</td>\n",
       "      <td>0.03</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37751</th>\n",
       "      <td>QTQ</td>\n",
       "      <td>TFB</td>\n",
       "      <td>BA2168QTQQEY</td>\n",
       "      <td>BA2478QEYTFB</td>\n",
       "      <td>Y</td>\n",
       "      <td>201.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>715 rows × 8 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Origin Destination       Flight1       Flight2 Class   Fare   TRD  \\\n",
       "3124     BOD         TJU  AA0066BODKOV  AA0070KOVTJU     B  155.0  0.00   \n",
       "3125     BOD         TJU  AA0066BODKOV  AA0070KOVTJU     G  147.0  0.00   \n",
       "3126     BOD         TJU  AA0066BODKOV  AA0070KOVTJU     H  242.0  0.00   \n",
       "3127     BOD         TJU  AA0066BODKOV  AA0070KOVTJU     K   99.0  0.00   \n",
       "3128     BOD         TJU  AA0066BODKOV  AA0070KOVTJU     L  172.0  0.33   \n",
       "...      ...         ...           ...           ...   ...    ...   ...   \n",
       "37747    QTQ         TFB  BA2168QTQQEY  BA2478QEYTFB     Q   83.0  0.01   \n",
       "37748    QTQ         TFB  BA2168QTQQEY  BA2478QEYTFB     S   98.0  0.00   \n",
       "37749    QTQ         TFB  BA2168QTQQEY  BA2478QEYTFB     T  105.0  3.00   \n",
       "37750    QTQ         TFB  BA2168QTQQEY  BA2478QEYTFB     V  178.0  0.03   \n",
       "37751    QTQ         TFB  BA2168QTQQEY  BA2478QEYTFB     Y  201.0  0.00   \n",
       "\n",
       "       Transfer times  \n",
       "3124                2  \n",
       "3125                2  \n",
       "3126                2  \n",
       "3127                2  \n",
       "3128                2  \n",
       "...               ...  \n",
       "37747               2  \n",
       "37748               2  \n",
       "37749               2  \n",
       "37750               2  \n",
       "37751               2  \n",
       "\n",
       "[715 rows x 8 columns]"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "groups[1][~groups[1].Flight1.isin(schedual.Flight)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:25:49.265133Z",
     "iopub.status.busy": "2021-05-29T12:25:49.264132Z",
     "iopub.status.idle": "2021-05-29T12:25:49.305101Z",
     "shell.execute_reply": "2021-05-29T12:25:49.303100Z",
     "shell.execute_reply.started": "2021-05-29T12:25:49.265133Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>dep_ucl</th>\n",
       "      <th>arr_ucl</th>\n",
       "      <th>delta_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "Empty DataFrame\n",
       "Columns: [Flight, deptime, arrtime, dep_ucl, arr_ucl, delta_time]\n",
       "Index: []"
      ]
     },
     "execution_count": 66,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "schedual[schedual.Flight == 'AA0066BODKOV']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 52,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:19:28.864879Z",
     "iopub.status.busy": "2021-05-29T12:19:28.863879Z",
     "iopub.status.idle": "2021-05-29T12:19:28.897117Z",
     "shell.execute_reply": "2021-05-29T12:19:28.895175Z",
     "shell.execute_reply.started": "2021-05-29T12:19:28.864879Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "      <th>Flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>dep_ucl</th>\n",
       "      <th>arr_ucl</th>\n",
       "      <th>delta_time</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>B</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>G</td>\n",
       "      <td>252.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>H</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.33</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>K</td>\n",
       "      <td>245.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>L</td>\n",
       "      <td>341.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 17:47:00</td>\n",
       "      <td>2021-05-30 00:53:00</td>\n",
       "      <td>2021-05-30 01:47:00</td>\n",
       "      <td>54.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   Origin Destination       Flight1       Flight2 Class   Fare   TRD  \\\n",
       "30    BER         TFB  AA0040BERBOD  AA0104BODTFB     B  512.0  0.00   \n",
       "30    BER         TFB  AA0040BERBOD  AA0104BODTFB     G  252.0  0.00   \n",
       "30    BER         TFB  AA0040BERBOD  AA0104BODTFB     H  512.0  0.33   \n",
       "30    BER         TFB  AA0040BERBOD  AA0104BODTFB     K  245.0  0.00   \n",
       "30    BER         TFB  AA0040BERBOD  AA0104BODTFB     L  341.0  0.00   \n",
       "\n",
       "    Transfer times        Flight              deptime              arrtime  \\\n",
       "30               2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "30               2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "30               2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "30               2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "30               2  AA0040BERBOD  2021-05-29 16:53:00  2021-05-29 17:47:00   \n",
       "\n",
       "                dep_ucl              arr_ucl  delta_time  \n",
       "30  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "30  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "30  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "30  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  \n",
       "30  2021-05-30 00:53:00  2021-05-30 01:47:00        54.0  "
      ]
     },
     "execution_count": 52,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group2.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:19:07.293207Z",
     "iopub.status.busy": "2021-05-29T12:19:07.293207Z",
     "iopub.status.idle": "2021-05-29T12:19:07.364196Z",
     "shell.execute_reply": "2021-05-29T12:19:07.362196Z",
     "shell.execute_reply.started": "2021-05-29T12:19:07.293207Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "<class 'pandas.core.frame.DataFrame'>\n",
      "Int64Index: 34067 entries, 30 to 782\n",
      "Data columns (total 14 columns):\n",
      " #   Column          Non-Null Count  Dtype  \n",
      "---  ------          --------------  -----  \n",
      " 0   Origin          34067 non-null  object \n",
      " 1   Destination     34067 non-null  object \n",
      " 2   Flight1         34067 non-null  object \n",
      " 3   Flight2         34067 non-null  object \n",
      " 4   Class           34067 non-null  object \n",
      " 5   Fare            34067 non-null  float64\n",
      " 6   TRD             34067 non-null  float64\n",
      " 7   Transfer times  34067 non-null  int64  \n",
      " 8   Flight          34067 non-null  object \n",
      " 9   deptime         34067 non-null  object \n",
      " 10  arrtime         34067 non-null  object \n",
      " 11  dep_ucl         34067 non-null  object \n",
      " 12  arr_ucl         34067 non-null  object \n",
      " 13  delta_time      34067 non-null  float64\n",
      "dtypes: float64(3), int64(1), object(10)\n",
      "memory usage: 3.9+ MB\n"
     ]
    }
   ],
   "source": [
    "group2 = pd.merge(groups[1],schedual,left_on='Flight1',right_on='Flight',left_index=True)\n",
    "# group2 = pd.merge(group2,schedual,left_on='Flight2',right_on='Flight',left_index=True,\n",
    "#          suffixes=['_1','_2'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:55:12.008598Z",
     "iopub.status.busy": "2021-05-29T11:55:12.007597Z",
     "iopub.status.idle": "2021-05-29T11:55:12.086609Z",
     "shell.execute_reply": "2021-05-29T11:55:12.084611Z",
     "shell.execute_reply.started": "2021-05-29T11:55:12.008598Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "      <th>Flight_1</th>\n",
       "      <th>deptime_1</th>\n",
       "      <th>arrtime_1</th>\n",
       "      <th>dep_ucl_1</th>\n",
       "      <th>arr_ucl_1</th>\n",
       "      <th>delta_time_1</th>\n",
       "      <th>Flight_2</th>\n",
       "      <th>deptime_2</th>\n",
       "      <th>arrtime_2</th>\n",
       "      <th>dep_ucl_2</th>\n",
       "      <th>arr_ucl_2</th>\n",
       "      <th>delta_time_2</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>B</td>\n",
       "      <td>233.000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>2021-05-29 15:10:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "      <td>2021-05-29 22:10:00</td>\n",
       "      <td>2021-05-29 22:50:00</td>\n",
       "      <td>40.0</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>2021-05-29 08:25:00</td>\n",
       "      <td>2021-05-29 10:45:00</td>\n",
       "      <td>2021-05-29 15:25:00</td>\n",
       "      <td>2021-05-29 17:45:00</td>\n",
       "      <td>140.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>G</td>\n",
       "      <td>91.000</td>\n",
       "      <td>1.38</td>\n",
       "      <td>2</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>2021-05-29 15:10:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "      <td>2021-05-29 22:10:00</td>\n",
       "      <td>2021-05-29 22:50:00</td>\n",
       "      <td>40.0</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>2021-05-29 08:25:00</td>\n",
       "      <td>2021-05-29 10:45:00</td>\n",
       "      <td>2021-05-29 15:25:00</td>\n",
       "      <td>2021-05-29 17:45:00</td>\n",
       "      <td>140.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>H</td>\n",
       "      <td>186.000</td>\n",
       "      <td>0.23</td>\n",
       "      <td>2</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>2021-05-29 15:10:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "      <td>2021-05-29 22:10:00</td>\n",
       "      <td>2021-05-29 22:50:00</td>\n",
       "      <td>40.0</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>2021-05-29 08:25:00</td>\n",
       "      <td>2021-05-29 10:45:00</td>\n",
       "      <td>2021-05-29 15:25:00</td>\n",
       "      <td>2021-05-29 17:45:00</td>\n",
       "      <td>140.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>K</td>\n",
       "      <td>106.000</td>\n",
       "      <td>0.53</td>\n",
       "      <td>2</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>2021-05-29 15:10:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "      <td>2021-05-29 22:10:00</td>\n",
       "      <td>2021-05-29 22:50:00</td>\n",
       "      <td>40.0</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>2021-05-29 08:25:00</td>\n",
       "      <td>2021-05-29 10:45:00</td>\n",
       "      <td>2021-05-29 15:25:00</td>\n",
       "      <td>2021-05-29 17:45:00</td>\n",
       "      <td>140.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>L</td>\n",
       "      <td>145.000</td>\n",
       "      <td>0.33</td>\n",
       "      <td>2</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>2021-05-29 15:10:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "      <td>2021-05-29 22:10:00</td>\n",
       "      <td>2021-05-29 22:50:00</td>\n",
       "      <td>40.0</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>2021-05-29 08:25:00</td>\n",
       "      <td>2021-05-29 10:45:00</td>\n",
       "      <td>2021-05-29 15:25:00</td>\n",
       "      <td>2021-05-29 17:45:00</td>\n",
       "      <td>140.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>703</th>\n",
       "      <td>PHH</td>\n",
       "      <td>CPJ</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>Q</td>\n",
       "      <td>262.000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>2021-05-29 09:00:00</td>\n",
       "      <td>2021-05-29 17:03:00</td>\n",
       "      <td>2021-05-29 19:00:00</td>\n",
       "      <td>2021-05-30 00:03:00</td>\n",
       "      <td>303.0</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>2021-05-29 13:23:00</td>\n",
       "      <td>2021-05-29 15:55:00</td>\n",
       "      <td>2021-05-29 20:23:00</td>\n",
       "      <td>2021-05-29 21:55:00</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>703</th>\n",
       "      <td>PHH</td>\n",
       "      <td>CPJ</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>S</td>\n",
       "      <td>392.000</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>2021-05-29 09:00:00</td>\n",
       "      <td>2021-05-29 17:03:00</td>\n",
       "      <td>2021-05-29 19:00:00</td>\n",
       "      <td>2021-05-30 00:03:00</td>\n",
       "      <td>303.0</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>2021-05-29 13:23:00</td>\n",
       "      <td>2021-05-29 15:55:00</td>\n",
       "      <td>2021-05-29 20:23:00</td>\n",
       "      <td>2021-05-29 21:55:00</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>703</th>\n",
       "      <td>PHH</td>\n",
       "      <td>CPJ</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>T</td>\n",
       "      <td>241.931</td>\n",
       "      <td>0.14</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>2021-05-29 09:00:00</td>\n",
       "      <td>2021-05-29 17:03:00</td>\n",
       "      <td>2021-05-29 19:00:00</td>\n",
       "      <td>2021-05-30 00:03:00</td>\n",
       "      <td>303.0</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>2021-05-29 13:23:00</td>\n",
       "      <td>2021-05-29 15:55:00</td>\n",
       "      <td>2021-05-29 20:23:00</td>\n",
       "      <td>2021-05-29 21:55:00</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>703</th>\n",
       "      <td>PHH</td>\n",
       "      <td>CPJ</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>V</td>\n",
       "      <td>278.000</td>\n",
       "      <td>0.72</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>2021-05-29 09:00:00</td>\n",
       "      <td>2021-05-29 17:03:00</td>\n",
       "      <td>2021-05-29 19:00:00</td>\n",
       "      <td>2021-05-30 00:03:00</td>\n",
       "      <td>303.0</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>2021-05-29 13:23:00</td>\n",
       "      <td>2021-05-29 15:55:00</td>\n",
       "      <td>2021-05-29 20:23:00</td>\n",
       "      <td>2021-05-29 21:55:00</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>703</th>\n",
       "      <td>PHH</td>\n",
       "      <td>CPJ</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>Y</td>\n",
       "      <td>391.000</td>\n",
       "      <td>0.53</td>\n",
       "      <td>2</td>\n",
       "      <td>AA0820PHHTNG</td>\n",
       "      <td>2021-05-29 09:00:00</td>\n",
       "      <td>2021-05-29 17:03:00</td>\n",
       "      <td>2021-05-29 19:00:00</td>\n",
       "      <td>2021-05-30 00:03:00</td>\n",
       "      <td>303.0</td>\n",
       "      <td>BA2412TNGCPJ</td>\n",
       "      <td>2021-05-29 13:23:00</td>\n",
       "      <td>2021-05-29 15:55:00</td>\n",
       "      <td>2021-05-29 20:23:00</td>\n",
       "      <td>2021-05-29 21:55:00</td>\n",
       "      <td>92.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>165 rows × 20 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Origin Destination       Flight1       Flight2 Class     Fare   TRD  \\\n",
       "328    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT     B  233.000  0.00   \n",
       "328    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT     G   91.000  1.38   \n",
       "328    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT     H  186.000  0.23   \n",
       "328    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT     K  106.000  0.53   \n",
       "328    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT     L  145.000  0.33   \n",
       "..     ...         ...           ...           ...   ...      ...   ...   \n",
       "703    PHH         CPJ  AA0820PHHTNG  BA2412TNGCPJ     Q  262.000  0.00   \n",
       "703    PHH         CPJ  AA0820PHHTNG  BA2412TNGCPJ     S  392.000  0.00   \n",
       "703    PHH         CPJ  AA0820PHHTNG  BA2412TNGCPJ     T  241.931  0.14   \n",
       "703    PHH         CPJ  AA0820PHHTNG  BA2412TNGCPJ     V  278.000  0.72   \n",
       "703    PHH         CPJ  AA0820PHHTNG  BA2412TNGCPJ     Y  391.000  0.53   \n",
       "\n",
       "     Transfer times      Flight_1            deptime_1            arrtime_1  \\\n",
       "328               2  BA2489CMJTFB  2021-05-29 15:10:00  2021-05-29 15:50:00   \n",
       "328               2  BA2489CMJTFB  2021-05-29 15:10:00  2021-05-29 15:50:00   \n",
       "328               2  BA2489CMJTFB  2021-05-29 15:10:00  2021-05-29 15:50:00   \n",
       "328               2  BA2489CMJTFB  2021-05-29 15:10:00  2021-05-29 15:50:00   \n",
       "328               2  BA2489CMJTFB  2021-05-29 15:10:00  2021-05-29 15:50:00   \n",
       "..              ...           ...                  ...                  ...   \n",
       "703               2  AA0820PHHTNG  2021-05-29 09:00:00  2021-05-29 17:03:00   \n",
       "703               2  AA0820PHHTNG  2021-05-29 09:00:00  2021-05-29 17:03:00   \n",
       "703               2  AA0820PHHTNG  2021-05-29 09:00:00  2021-05-29 17:03:00   \n",
       "703               2  AA0820PHHTNG  2021-05-29 09:00:00  2021-05-29 17:03:00   \n",
       "703               2  AA0820PHHTNG  2021-05-29 09:00:00  2021-05-29 17:03:00   \n",
       "\n",
       "               dep_ucl_1            arr_ucl_1  delta_time_1      Flight_2  \\\n",
       "328  2021-05-29 22:10:00  2021-05-29 22:50:00          40.0  AA0608TFBMBT   \n",
       "328  2021-05-29 22:10:00  2021-05-29 22:50:00          40.0  AA0608TFBMBT   \n",
       "328  2021-05-29 22:10:00  2021-05-29 22:50:00          40.0  AA0608TFBMBT   \n",
       "328  2021-05-29 22:10:00  2021-05-29 22:50:00          40.0  AA0608TFBMBT   \n",
       "328  2021-05-29 22:10:00  2021-05-29 22:50:00          40.0  AA0608TFBMBT   \n",
       "..                   ...                  ...           ...           ...   \n",
       "703  2021-05-29 19:00:00  2021-05-30 00:03:00         303.0  BA2412TNGCPJ   \n",
       "703  2021-05-29 19:00:00  2021-05-30 00:03:00         303.0  BA2412TNGCPJ   \n",
       "703  2021-05-29 19:00:00  2021-05-30 00:03:00         303.0  BA2412TNGCPJ   \n",
       "703  2021-05-29 19:00:00  2021-05-30 00:03:00         303.0  BA2412TNGCPJ   \n",
       "703  2021-05-29 19:00:00  2021-05-30 00:03:00         303.0  BA2412TNGCPJ   \n",
       "\n",
       "               deptime_2            arrtime_2            dep_ucl_2  \\\n",
       "328  2021-05-29 08:25:00  2021-05-29 10:45:00  2021-05-29 15:25:00   \n",
       "328  2021-05-29 08:25:00  2021-05-29 10:45:00  2021-05-29 15:25:00   \n",
       "328  2021-05-29 08:25:00  2021-05-29 10:45:00  2021-05-29 15:25:00   \n",
       "328  2021-05-29 08:25:00  2021-05-29 10:45:00  2021-05-29 15:25:00   \n",
       "328  2021-05-29 08:25:00  2021-05-29 10:45:00  2021-05-29 15:25:00   \n",
       "..                   ...                  ...                  ...   \n",
       "703  2021-05-29 13:23:00  2021-05-29 15:55:00  2021-05-29 20:23:00   \n",
       "703  2021-05-29 13:23:00  2021-05-29 15:55:00  2021-05-29 20:23:00   \n",
       "703  2021-05-29 13:23:00  2021-05-29 15:55:00  2021-05-29 20:23:00   \n",
       "703  2021-05-29 13:23:00  2021-05-29 15:55:00  2021-05-29 20:23:00   \n",
       "703  2021-05-29 13:23:00  2021-05-29 15:55:00  2021-05-29 20:23:00   \n",
       "\n",
       "               arr_ucl_2  delta_time_2  \n",
       "328  2021-05-29 17:45:00         140.0  \n",
       "328  2021-05-29 17:45:00         140.0  \n",
       "328  2021-05-29 17:45:00         140.0  \n",
       "328  2021-05-29 17:45:00         140.0  \n",
       "328  2021-05-29 17:45:00         140.0  \n",
       "..                   ...           ...  \n",
       "703  2021-05-29 21:55:00          92.0  \n",
       "703  2021-05-29 21:55:00          92.0  \n",
       "703  2021-05-29 21:55:00          92.0  \n",
       "703  2021-05-29 21:55:00          92.0  \n",
       "703  2021-05-29 21:55:00          92.0  \n",
       "\n",
       "[165 rows x 20 columns]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group2[group2.arr_ucl_1 >= group2.dep_ucl_2 ]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:15:17.977387Z",
     "iopub.status.busy": "2021-05-29T12:15:17.976386Z",
     "iopub.status.idle": "2021-05-29T12:15:18.018520Z",
     "shell.execute_reply": "2021-05-29T12:15:18.016520Z",
     "shell.execute_reply.started": "2021-05-29T12:15:17.977387Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>TRD</th>\n",
       "      <th>Transfer times</th>\n",
       "      <th>deptime</th>\n",
       "      <th>arrtime</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>B</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 23:29:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>G</td>\n",
       "      <td>252.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 23:29:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>H</td>\n",
       "      <td>512.0</td>\n",
       "      <td>0.33</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 23:29:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>K</td>\n",
       "      <td>245.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 23:29:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>110</th>\n",
       "      <td>BER</td>\n",
       "      <td>TFB</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>AA0104BODTFB</td>\n",
       "      <td>L</td>\n",
       "      <td>341.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 16:53:00</td>\n",
       "      <td>2021-05-29 23:29:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>TFB</td>\n",
       "      <td>CPT</td>\n",
       "      <td>BA2629TFBQEY</td>\n",
       "      <td>AA0030QEYCPT</td>\n",
       "      <td>Q</td>\n",
       "      <td>146.0</td>\n",
       "      <td>0.39</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 06:00:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>TFB</td>\n",
       "      <td>CPT</td>\n",
       "      <td>BA2629TFBQEY</td>\n",
       "      <td>AA0030QEYCPT</td>\n",
       "      <td>S</td>\n",
       "      <td>440.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 06:00:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>TFB</td>\n",
       "      <td>CPT</td>\n",
       "      <td>BA2629TFBQEY</td>\n",
       "      <td>AA0030QEYCPT</td>\n",
       "      <td>T</td>\n",
       "      <td>135.0</td>\n",
       "      <td>1.05</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 06:00:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>TFB</td>\n",
       "      <td>CPT</td>\n",
       "      <td>BA2629TFBQEY</td>\n",
       "      <td>AA0030QEYCPT</td>\n",
       "      <td>V</td>\n",
       "      <td>209.0</td>\n",
       "      <td>1.12</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 06:00:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>TFB</td>\n",
       "      <td>CPT</td>\n",
       "      <td>BA2629TFBQEY</td>\n",
       "      <td>AA0030QEYCPT</td>\n",
       "      <td>Y</td>\n",
       "      <td>277.0</td>\n",
       "      <td>0.61</td>\n",
       "      <td>2</td>\n",
       "      <td>2021-05-29 06:00:00</td>\n",
       "      <td>2021-05-29 15:50:00</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>33308 rows × 10 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "    Origin Destination       Flight1       Flight2 Class   Fare   TRD  \\\n",
       "110    BER         TFB  AA0040BERBOD  AA0104BODTFB     B  512.0  0.00   \n",
       "110    BER         TFB  AA0040BERBOD  AA0104BODTFB     G  252.0  0.00   \n",
       "110    BER         TFB  AA0040BERBOD  AA0104BODTFB     H  512.0  0.33   \n",
       "110    BER         TFB  AA0040BERBOD  AA0104BODTFB     K  245.0  0.00   \n",
       "110    BER         TFB  AA0040BERBOD  AA0104BODTFB     L  341.0  0.00   \n",
       "..     ...         ...           ...           ...   ...    ...   ...   \n",
       "24     TFB         CPT  BA2629TFBQEY  AA0030QEYCPT     Q  146.0  0.39   \n",
       "24     TFB         CPT  BA2629TFBQEY  AA0030QEYCPT     S  440.0  0.00   \n",
       "24     TFB         CPT  BA2629TFBQEY  AA0030QEYCPT     T  135.0  1.05   \n",
       "24     TFB         CPT  BA2629TFBQEY  AA0030QEYCPT     V  209.0  1.12   \n",
       "24     TFB         CPT  BA2629TFBQEY  AA0030QEYCPT     Y  277.0  0.61   \n",
       "\n",
       "     Transfer times              deptime              arrtime  \n",
       "110               2  2021-05-29 16:53:00  2021-05-29 23:29:00  \n",
       "110               2  2021-05-29 16:53:00  2021-05-29 23:29:00  \n",
       "110               2  2021-05-29 16:53:00  2021-05-29 23:29:00  \n",
       "110               2  2021-05-29 16:53:00  2021-05-29 23:29:00  \n",
       "110               2  2021-05-29 16:53:00  2021-05-29 23:29:00  \n",
       "..              ...                  ...                  ...  \n",
       "24                2  2021-05-29 06:00:00  2021-05-29 15:50:00  \n",
       "24                2  2021-05-29 06:00:00  2021-05-29 15:50:00  \n",
       "24                2  2021-05-29 06:00:00  2021-05-29 15:50:00  \n",
       "24                2  2021-05-29 06:00:00  2021-05-29 15:50:00  \n",
       "24                2  2021-05-29 06:00:00  2021-05-29 15:50:00  \n",
       "\n",
       "[33308 rows x 10 columns]"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "group2_new"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:14:55.857973Z",
     "iopub.status.busy": "2021-05-29T12:14:55.856972Z",
     "iopub.status.idle": "2021-05-29T12:14:55.963919Z",
     "shell.execute_reply": "2021-05-29T12:14:55.958916Z",
     "shell.execute_reply.started": "2021-05-29T12:14:55.857973Z"
    }
   },
   "outputs": [
    {
     "ename": "TypeError",
     "evalue": "unsupported operand type(s) for +: 'numpy.ndarray' and 'pandas._libs.tslibs.offsets.Day'",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\array_ops.py\u001b[0m in \u001b[0;36mna_arithmetic_op\u001b[1;34m(left, right, op, is_cmp)\u001b[0m\n\u001b[0;32m    142\u001b[0m     \u001b[1;32mtry\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 143\u001b[1;33m         \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mexpressions\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mevaluate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mleft\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mright\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    144\u001b[0m     \u001b[1;32mexcept\u001b[0m \u001b[0mTypeError\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expressions.py\u001b[0m in \u001b[0;36mevaluate\u001b[1;34m(op, a, b, use_numexpr)\u001b[0m\n\u001b[0;32m    232\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0muse_numexpr\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 233\u001b[1;33m             \u001b[1;32mreturn\u001b[0m \u001b[0m_evaluate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop_str\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m  \u001b[1;31m# type: ignore\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    234\u001b[0m     \u001b[1;32mreturn\u001b[0m \u001b[0m_evaluate_standard\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop_str\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expressions.py\u001b[0m in \u001b[0;36m_evaluate_numexpr\u001b[1;34m(op, op_str, a, b)\u001b[0m\n\u001b[0;32m    118\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;32mis\u001b[0m \u001b[1;32mNone\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 119\u001b[1;33m         \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0m_evaluate_standard\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mop\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop_str\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    120\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\computation\\expressions.py\u001b[0m in \u001b[0;36m_evaluate_standard\u001b[1;34m(op, op_str, a, b)\u001b[0m\n\u001b[0;32m     67\u001b[0m     \u001b[1;32mwith\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merrstate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mall\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"ignore\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 68\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0ma\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mb\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     69\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'numpy.ndarray' and 'pandas._libs.tslibs.offsets.Day'",
      "\nDuring handling of the above exception, another exception occurred:\n",
      "\u001b[1;31mTypeError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-41-136ff4cc5d27>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m\u001b[0m\n\u001b[0;32m      2\u001b[0m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'deptime'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdeptime_1\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      3\u001b[0m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'arrtime'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marrtime_2\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 4\u001b[1;33m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marr_ucl_1\u001b[0m \u001b[1;33m>=\u001b[0m \u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdep_ucl_2\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'arrtime'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marr_ucl_1\u001b[0m \u001b[1;33m>=\u001b[0m \u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdep_ucl_2\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'arrtime'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m+\u001b[0m \u001b[0mDay\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      5\u001b[0m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mloc\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;34m'delta_time'\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0marr_ucl_2\u001b[0m \u001b[1;33m-\u001b[0m \u001b[0mgroup2\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mdep_ucl_1\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mseconds\u001b[0m \u001b[1;33m/\u001b[0m \u001b[1;36m60\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m      6\u001b[0m \u001b[0mgroup2_new\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mhead\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\common.py\u001b[0m in \u001b[0;36mnew_method\u001b[1;34m(self, other)\u001b[0m\n\u001b[0;32m     63\u001b[0m         \u001b[0mother\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mitem_from_zerodim\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     64\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 65\u001b[1;33m         \u001b[1;32mreturn\u001b[0m \u001b[0mmethod\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mself\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mother\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m     66\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m     67\u001b[0m     \u001b[1;32mreturn\u001b[0m \u001b[0mnew_method\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\__init__.py\u001b[0m in \u001b[0;36mwrapper\u001b[1;34m(left, right)\u001b[0m\n\u001b[0;32m    341\u001b[0m         \u001b[0mlvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextract_array\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mleft\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextract_numpy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    342\u001b[0m         \u001b[0mrvalues\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mextract_array\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mright\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mextract_numpy\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;32mTrue\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 343\u001b[1;33m         \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0marithmetic_op\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    344\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    345\u001b[0m         \u001b[1;32mreturn\u001b[0m \u001b[0mleft\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0m_construct_result\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mname\u001b[0m\u001b[1;33m=\u001b[0m\u001b[0mres_name\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\array_ops.py\u001b[0m in \u001b[0;36marithmetic_op\u001b[1;34m(left, right, op)\u001b[0m\n\u001b[0;32m    188\u001b[0m     \u001b[1;32melse\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    189\u001b[0m         \u001b[1;32mwith\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merrstate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mall\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"ignore\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 190\u001b[1;33m             \u001b[0mres_values\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mna_arithmetic_op\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mlvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mrvalues\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    191\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    192\u001b[0m     \u001b[1;32mreturn\u001b[0m \u001b[0mres_values\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\array_ops.py\u001b[0m in \u001b[0;36mna_arithmetic_op\u001b[1;34m(left, right, op, is_cmp)\u001b[0m\n\u001b[0;32m    148\u001b[0m             \u001b[1;31m#  will handle complex numbers incorrectly, see GH#32047\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    149\u001b[0m             \u001b[1;32mraise\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 150\u001b[1;33m         \u001b[0mresult\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmasked_arith_op\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mleft\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mright\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    151\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    152\u001b[0m     \u001b[1;32mif\u001b[0m \u001b[0mis_cmp\u001b[0m \u001b[1;32mand\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mis_scalar\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;32mor\u001b[0m \u001b[0mresult\u001b[0m \u001b[1;32mis\u001b[0m \u001b[0mNotImplemented\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;32mD:\\Anaconda3\\lib\\site-packages\\pandas\\core\\ops\\array_ops.py\u001b[0m in \u001b[0;36mmasked_arith_op\u001b[1;34m(x, y, op)\u001b[0m\n\u001b[0;32m    110\u001b[0m         \u001b[1;32mif\u001b[0m \u001b[0mmask\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0many\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    111\u001b[0m             \u001b[1;32mwith\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0merrstate\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mall\u001b[0m\u001b[1;33m=\u001b[0m\u001b[1;34m\"ignore\"\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m--> 112\u001b[1;33m                 \u001b[0mresult\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mmask\u001b[0m\u001b[1;33m]\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mop\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mxrav\u001b[0m\u001b[1;33m[\u001b[0m\u001b[0mmask\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0my\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m    113\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m    114\u001b[0m     \u001b[0mresult\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0m_\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mmaybe_upcast_putmask\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mresult\u001b[0m\u001b[1;33m,\u001b[0m \u001b[1;33m~\u001b[0m\u001b[0mmask\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mnp\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mnan\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mTypeError\u001b[0m: unsupported operand type(s) for +: 'numpy.ndarray' and 'pandas._libs.tslibs.offsets.Day'"
     ]
    }
   ],
   "source": [
    "group2_new = group2.loc[:,:'Transfer times']\n",
    "group2_new.loc[:,'deptime'] = group2.deptime_1\n",
    "group2_new.loc[:,'arrtime'] = group2.arrtime_2\n",
    "group2_new[group2.arr_ucl_1 >= group2.dep_ucl_2].loc[:,'arrtime'] = group2_new[group2.arr_ucl_1 >= group2.dep_ucl_2].loc[:,'arrtime'] + Day(1)\n",
    "group2_new.loc[:,'delta_time'] = (group2.arr_ucl_2 - group2.dep_ucl_1).seconds / 60\n",
    "group2_new.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:52:17.788987Z",
     "iopub.status.busy": "2021-05-29T11:52:17.787987Z",
     "iopub.status.idle": "2021-05-29T11:52:17.822991Z",
     "shell.execute_reply": "2021-05-29T11:52:17.818989Z",
     "shell.execute_reply.started": "2021-05-29T11:52:17.788987Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>depoff</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>arroff</th>\n",
       "      <th>origin</th>\n",
       "      <th>destination</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>AA0001</td>\n",
       "      <td>755</td>\n",
       "      <td>-400</td>\n",
       "      <td>1038</td>\n",
       "      <td>-700</td>\n",
       "      <td>EDB</td>\n",
       "      <td>TFB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>AA0002</td>\n",
       "      <td>1405</td>\n",
       "      <td>-700</td>\n",
       "      <td>2159</td>\n",
       "      <td>-400</td>\n",
       "      <td>TFB</td>\n",
       "      <td>EDB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>AA0003</td>\n",
       "      <td>1740</td>\n",
       "      <td>-400</td>\n",
       "      <td>2025</td>\n",
       "      <td>-700</td>\n",
       "      <td>EDB</td>\n",
       "      <td>TFB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>AA0004</td>\n",
       "      <td>840</td>\n",
       "      <td>-700</td>\n",
       "      <td>1640</td>\n",
       "      <td>-400</td>\n",
       "      <td>TFB</td>\n",
       "      <td>EDB</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>AA0005</td>\n",
       "      <td>910</td>\n",
       "      <td>-400</td>\n",
       "      <td>1202</td>\n",
       "      <td>-700</td>\n",
       "      <td>EDB</td>\n",
       "      <td>MBY</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "   flight  deptime  depoff  arrtime  arroff origin destination\n",
       "0  AA0001      755    -400     1038    -700    EDB         TFB\n",
       "1  AA0002     1405    -700     2159    -400    TFB         EDB\n",
       "2  AA0003     1740    -400     2025    -700    EDB         TFB\n",
       "3  AA0004      840    -700     1640    -400    TFB         EDB\n",
       "4  AA0005      910    -400     1202    -700    EDB         MBY"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_schedual = pd.read_csv(os.path.join(data_dir,data_files[3]))\n",
    "raw_schedual.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:52:58.064152Z",
     "iopub.status.busy": "2021-05-29T11:52:58.064152Z",
     "iopub.status.idle": "2021-05-29T11:52:58.086154Z",
     "shell.execute_reply": "2021-05-29T11:52:58.084152Z",
     "shell.execute_reply.started": "2021-05-29T11:52:58.064152Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>depoff</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>arroff</th>\n",
       "      <th>origin</th>\n",
       "      <th>destination</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>745</th>\n",
       "      <td>BA2489</td>\n",
       "      <td>1510</td>\n",
       "      <td>-700</td>\n",
       "      <td>1550</td>\n",
       "      <td>-700</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>TFB</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     flight  deptime  depoff  arrtime  arroff origin destination\n",
       "745  BA2489     1510    -700     1550    -700    CMJ         TFB"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_schedual[raw_schedual.flight=='BA2489']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:53:32.080006Z",
     "iopub.status.busy": "2021-05-29T11:53:32.080006Z",
     "iopub.status.idle": "2021-05-29T11:53:32.114969Z",
     "shell.execute_reply": "2021-05-29T11:53:32.112456Z",
     "shell.execute_reply.started": "2021-05-29T11:53:32.080006Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>depoff</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>arroff</th>\n",
       "      <th>origin</th>\n",
       "      <th>destination</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>AA0608</td>\n",
       "      <td>825</td>\n",
       "      <td>-700</td>\n",
       "      <td>1045</td>\n",
       "      <td>-700</td>\n",
       "      <td>TFB</td>\n",
       "      <td>MBT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     flight  deptime  depoff  arrtime  arroff origin destination\n",
       "328  AA0608      825    -700     1045    -700    TFB         MBT"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_schedual[raw_schedual.flight=='AA0608']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T11:54:17.452494Z",
     "iopub.status.busy": "2021-05-29T11:54:17.451498Z",
     "iopub.status.idle": "2021-05-29T11:54:17.662512Z",
     "shell.execute_reply": "2021-05-29T11:54:17.661511Z",
     "shell.execute_reply.started": "2021-05-29T11:54:17.451498Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Flight3</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>RD0</th>\n",
       "      <th>RD1</th>\n",
       "      <th>RD2</th>\n",
       "      <th>...</th>\n",
       "      <th>RD89</th>\n",
       "      <th>RD99</th>\n",
       "      <th>RD119</th>\n",
       "      <th>RD139</th>\n",
       "      <th>RD159</th>\n",
       "      <th>RD179</th>\n",
       "      <th>RD209</th>\n",
       "      <th>RD239</th>\n",
       "      <th>RD269</th>\n",
       "      <th>RD330</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>.</td>\n",
       "      <td>.</td>\n",
       "      <td>B</td>\n",
       "      <td>230.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>.</td>\n",
       "      <td>.</td>\n",
       "      <td>G</td>\n",
       "      <td>100.0</td>\n",
       "      <td>0.67</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>.</td>\n",
       "      <td>.</td>\n",
       "      <td>H</td>\n",
       "      <td>105.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>.</td>\n",
       "      <td>.</td>\n",
       "      <td>K</td>\n",
       "      <td>94.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>BER</td>\n",
       "      <td>BOD</td>\n",
       "      <td>AA0040BERBOD</td>\n",
       "      <td>.</td>\n",
       "      <td>.</td>\n",
       "      <td>L</td>\n",
       "      <td>145.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.67</td>\n",
       "      <td>1.33</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "  Origin Destination       Flight1 Flight2 Flight3 Class   Fare   RD0  RD1  \\\n",
       "0    BER         BOD  AA0040BERBOD       .       .     B  230.0  0.00  0.0   \n",
       "1    BER         BOD  AA0040BERBOD       .       .     G  100.0  0.67  0.0   \n",
       "2    BER         BOD  AA0040BERBOD       .       .     H  105.0  0.00  0.0   \n",
       "3    BER         BOD  AA0040BERBOD       .       .     K   94.0  0.00  0.0   \n",
       "4    BER         BOD  AA0040BERBOD       .       .     L  145.0  0.00  0.0   \n",
       "\n",
       "   RD2  ...  RD89  RD99  RD119  RD139  RD159  RD179  RD209  RD239  RD269  \\\n",
       "0  0.0  ...   0.0  0.00   0.00    0.0    0.0    0.0    0.0    0.0    0.0   \n",
       "1  0.0  ...   0.0  0.00   0.00    0.0    0.0    0.0    0.0    0.0    0.0   \n",
       "2  0.0  ...   0.0  0.00   0.00    0.0    0.0    0.0    0.0    0.0    0.0   \n",
       "3  0.0  ...   0.0  0.00   0.00    0.0    0.0    0.0    0.0    0.0    0.0   \n",
       "4  0.0  ...   0.0  0.67   1.33    0.0    0.0    0.0    0.0    0.0    0.0   \n",
       "\n",
       "   RD330  \n",
       "0    0.0  \n",
       "1    0.0  \n",
       "2    0.0  \n",
       "3    0.0  \n",
       "4    0.0  \n",
       "\n",
       "[5 rows x 38 columns]"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_product = pd.read_csv(os.path.join(data_dir,data_files[2]))\n",
    "raw_product.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:01:22.115331Z",
     "iopub.status.busy": "2021-05-29T12:01:22.114331Z",
     "iopub.status.idle": "2021-05-29T12:01:22.135900Z",
     "shell.execute_reply": "2021-05-29T12:01:22.133331Z",
     "shell.execute_reply.started": "2021-05-29T12:01:22.115331Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>depoff</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>arroff</th>\n",
       "      <th>origin</th>\n",
       "      <th>destination</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>745</th>\n",
       "      <td>BA2489</td>\n",
       "      <td>1510</td>\n",
       "      <td>-700</td>\n",
       "      <td>1550</td>\n",
       "      <td>-700</td>\n",
       "      <td>CMJ</td>\n",
       "      <td>TFB</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     flight  deptime  depoff  arrtime  arroff origin destination\n",
       "745  BA2489     1510    -700     1550    -700    CMJ         TFB"
      ]
     },
     "execution_count": 36,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_schedual[raw_schedual.flight == 'BA2489']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:01:37.689987Z",
     "iopub.status.busy": "2021-05-29T12:01:37.689987Z",
     "iopub.status.idle": "2021-05-29T12:01:37.715798Z",
     "shell.execute_reply": "2021-05-29T12:01:37.712896Z",
     "shell.execute_reply.started": "2021-05-29T12:01:37.689987Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>flight</th>\n",
       "      <th>deptime</th>\n",
       "      <th>depoff</th>\n",
       "      <th>arrtime</th>\n",
       "      <th>arroff</th>\n",
       "      <th>origin</th>\n",
       "      <th>destination</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>328</th>\n",
       "      <td>AA0608</td>\n",
       "      <td>825</td>\n",
       "      <td>-700</td>\n",
       "      <td>1045</td>\n",
       "      <td>-700</td>\n",
       "      <td>TFB</td>\n",
       "      <td>MBT</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "     flight  deptime  depoff  arrtime  arroff origin destination\n",
       "328  AA0608      825    -700     1045    -700    TFB         MBT"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_schedual[raw_schedual.flight == 'AA0608']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "execution": {
     "iopub.execute_input": "2021-05-29T12:00:05.154708Z",
     "iopub.status.busy": "2021-05-29T12:00:05.153708Z",
     "iopub.status.idle": "2021-05-29T12:00:05.232737Z",
     "shell.execute_reply": "2021-05-29T12:00:05.231735Z",
     "shell.execute_reply.started": "2021-05-29T12:00:05.154708Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Origin</th>\n",
       "      <th>Destination</th>\n",
       "      <th>Flight1</th>\n",
       "      <th>Flight2</th>\n",
       "      <th>Flight3</th>\n",
       "      <th>Class</th>\n",
       "      <th>Fare</th>\n",
       "      <th>RD0</th>\n",
       "      <th>RD1</th>\n",
       "      <th>RD2</th>\n",
       "      <th>...</th>\n",
       "      <th>RD89</th>\n",
       "      <th>RD99</th>\n",
       "      <th>RD119</th>\n",
       "      <th>RD139</th>\n",
       "      <th>RD159</th>\n",
       "      <th>RD179</th>\n",
       "      <th>RD209</th>\n",
       "      <th>RD239</th>\n",
       "      <th>RD269</th>\n",
       "      <th>RD330</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>23045</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>B</td>\n",
       "      <td>233.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23046</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>G</td>\n",
       "      <td>91.0</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23047</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>H</td>\n",
       "      <td>186.0</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23048</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>K</td>\n",
       "      <td>106.0</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23049</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>L</td>\n",
       "      <td>145.0</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23050</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>M</td>\n",
       "      <td>216.0</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23051</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>Q</td>\n",
       "      <td>118.0</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23052</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>S</td>\n",
       "      <td>260.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23053</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>T</td>\n",
       "      <td>85.0</td>\n",
       "      <td>0.06</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.1</td>\n",
       "      <td>0.04</td>\n",
       "      <td>0.33</td>\n",
       "      <td>0.32</td>\n",
       "      <td>0.74</td>\n",
       "      <td>0.08</td>\n",
       "      <td>0.03</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23054</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>V</td>\n",
       "      <td>121.0</td>\n",
       "      <td>0.05</td>\n",
       "      <td>0.02</td>\n",
       "      <td>0.02</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23055</th>\n",
       "      <td>CMJ</td>\n",
       "      <td>MBT</td>\n",
       "      <td>BA2489CMJTFB</td>\n",
       "      <td>AA0608TFBMBT</td>\n",
       "      <td>.</td>\n",
       "      <td>Y</td>\n",
       "      <td>233.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>...</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.00</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>11 rows × 38 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "      Origin Destination       Flight1       Flight2 Flight3 Class   Fare  \\\n",
       "23045    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     B  233.0   \n",
       "23046    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     G   91.0   \n",
       "23047    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     H  186.0   \n",
       "23048    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     K  106.0   \n",
       "23049    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     L  145.0   \n",
       "23050    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     M  216.0   \n",
       "23051    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     Q  118.0   \n",
       "23052    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     S  260.0   \n",
       "23053    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     T   85.0   \n",
       "23054    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     V  121.0   \n",
       "23055    CMJ         MBT  BA2489CMJTFB  AA0608TFBMBT       .     Y  233.0   \n",
       "\n",
       "        RD0   RD1   RD2  ...  RD89  RD99  RD119  RD139  RD159  RD179  RD209  \\\n",
       "23045  0.00  0.00  0.00  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23046  0.05  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23047  0.04  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23048  0.05  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23049  0.05  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23050  0.04  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23051  0.05  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23052  0.00  0.00  0.00  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23053  0.06  0.03  0.02  ...   0.1  0.04   0.33   0.32   0.74   0.08   0.03   \n",
       "23054  0.05  0.02  0.02  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "23055  0.00  0.00  0.00  ...   0.0  0.00   0.00   0.00   0.00   0.00   0.00   \n",
       "\n",
       "       RD239  RD269  RD330  \n",
       "23045    0.0    0.0    0.0  \n",
       "23046    0.0    0.0    0.0  \n",
       "23047    0.0    0.0    0.0  \n",
       "23048    0.0    0.0    0.0  \n",
       "23049    0.0    0.0    0.0  \n",
       "23050    0.0    0.0    0.0  \n",
       "23051    0.0    0.0    0.0  \n",
       "23052    0.0    0.0    0.0  \n",
       "23053    0.0    0.0    0.0  \n",
       "23054    0.0    0.0    0.0  \n",
       "23055    0.0    0.0    0.0  \n",
       "\n",
       "[11 rows x 38 columns]"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "raw_product[(raw_product.Flight1=='BA2489CMJTFB') & (raw_product.Flight2=='AA0608TFBMBT')]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 这里注意一个航线可以到多个地方 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "execution": {
     "iopub.status.busy": "2021-05-29T11:48:27.714801Z",
     "iopub.status.idle": "2021-05-29T11:48:27.715802Z",
     "shell.execute_reply": "2021-05-29T11:48:27.715802Z"
    }
   },
   "outputs": [],
   "source": [
    "raw_schedual[raw_schedual.flight == 'AA0065']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
